import { createRouter, createWebHashHistory } from "vue-router";
import UserLayOut from "@/layout/UserLayOut.vue";
import AdminLayOutVue from "@/layout/AdminLayOut.vue";
const routes = [
  {
    path: "/",
    name: "home",
    component: UserLayOut,
    redirect: "/index",
    children: [
      {
        path: "index",
        name: "index",
        component: () => import("@/views/index.vue"),
      },
      {
        path: "cart",
        name: "cart",
        component: () => import("@/views/Cart.vue"),
      },
      {
        path: "indent",
        name: "indent",
        component: () => import("@/views/Indent.vue"),
      },
      {
        path: "user",
        name: "user",
        component: () => import("@/views/User.vue"),
      },
      {
        path: "goodsDetils",
        name: "goodsDetils",
        component: () => import("@/views/GoodsDetils.vue"),
      },
    ],
  },
  {
    path: "/admin",
    name: "admin",
    component: AdminLayOutVue,
    redirect: "/admin/goods",
    children: [
      {
        path: "goods",
        name: "goodsAdmin",
        component: () => import("@/views/admin/Goods.vue"),
      },
      {
        path: "accessory",
        name: "accessoryAdmin",
        component: () => import("@/views/admin/Accessory.vue"),
      },
      {
        path: "user",
        name: "userAdmin",
        component: () => import("@/views/admin/User.vue"),
      },
      {
        path: "indent",
        name: "indentAdmin",
        component: () => import("@/views/admin/Indent.vue"),
      },
      {
        path: "picture",
        name: "pictureAdmin",
        component: () => import("@/views/admin/Picture.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
